/**
* 作者: clz
* 日期: 2025-03-24 17:32:58
* 备注: 聊天记录表（单服+全服）
*/
package com.motu.monstercity.server.game.userdata;

import com.motu.monstercity.protocol.Common;
import com.motu.monstercity.protocol.Common.PBChatMsg;
import com.motu.monstercity.server.game.logic.ChatManager;
import com.motu.monstercity.server.game.logic.GameUser;
import com.motu.vertx.module.utility.toolset.TimeUtils;

public class ChatPublic extends ChatPublicModel {
	public ChatPublic() {
		super();
	}

	public ChatPublic(UserInfo userInfo, int groupId, int sid, String msg, int chatType, int subType, String param) {
		putGroupId(groupId);
		putServerId(sid);
		putSubType(subType);
		putChatType(chatType);
		if(userInfo != null) {
			putUserId(userInfo.getId());
			putUserName(userInfo.getUserName());
		}
		putContent(msg);
		putAddTime(TimeUtils.getCurTime());
		putParam(param);
	}

	/**
	 * 构建聊天下发格式
	 * @return
	 */
	public Common.PBChatMsg.Builder takeBuilder(){
		return ChatManager.takeChatMsgBuilder(getUserId(),getId(),getChatType(),getSubType(),getContent(),getAddTime(),getParam());
	}

}
